#ifndef __AUDIOVOICE_INCLUDED
#define __AUDIOVOICE_INCLUDED

namespace Audio
{
	namespace IO
	{
		class WaveFile;
	}

	class AudioDataBuffer
	{

	public:
		AudioDataBuffer();
		~AudioDataBuffer();

		unsigned char* GetNewBuffer(unsigned int size);
		unsigned char* GetCurrentBuffer();
		unsigned int   GetCurrentBufferSize();
		
	private:
		static const unsigned int bufferLength = 64 * 1024; 
		static const unsigned int numberOfbuffer = 2;
		unsigned char* buffer[numberOfbuffer];
		unsigned int   sizes[numberOfbuffer];
		unsigned int  currentBuffer;
		unsigned int  position;
	};	
		
	

	class AudioVoice : public ErroableObject
	{
	public:
			
		AudioVoice(const STRING& fileName);
		~AudioVoice();	
		

		void PreLoad();		
		
		AudioStream* CreateAudioStream();
		void DestroyAudioStream(AudioStream*& stream);
		
		unsigned int GetChannelCount() const;
		unsigned int GetSampleRate() const;
		unsigned int GetBitsPerSample() const ;
		unsigned int GetSampleCount() const;			

		void DeletePlayingVoice(AudioPlayingVoice* v);
		void AddPlayingVoice(AudioPlayingVoice* v);
		
		void* GetInfo() const;
		UINT32 GetInfoSize() const;
	protected:

		std::vector<AudioPlayingVoice*> playings;					
		bool				 loaded;
		IO::WaveFile*		 waveFile;
		STRING				 fileName;
	};

}


#endif